package org.xiaojl.common.base;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

public abstract class BaseEntity<T> implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@JsonSerialize(using=ToStringSerializer.class)//注解处理:ID_WORKER 主键 Long 导致 js 精度丢失
	protected Long id; //主键
	@TableField(fill = FieldFill.INSERT)// 该注解插入忽略验证，自动填充
	protected Long createBy ; //创建人Id
	@TableField(fill = FieldFill.INSERT)// 该注解插入忽略验证，自动填充
	protected Date createTime ; //创建时间
	@TableField(fill = FieldFill.INSERT)// 该注解插入忽略验证，自动填充
	protected Integer delFlag; //删除标记：0-未删除，1-删除
	
	/**
	 * 构建查询条件Wrapper实例
	 */
	public abstract Wrapper<T> bindingQueryWrapper();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getCreateBy() {
		return createBy;
	}

	public void setCreateBy(Long createBy) {
		this.createBy = createBy;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Integer getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(Integer delFlag) {
		this.delFlag = delFlag;
	}

	@Override
	public String toString() {
		return "BaseEntity [id=" + id + ", createBy=" + createBy
				+ ", createTime=" + createTime + ", delFlag=" + delFlag + "]";
	}
	
}
